home *** CD-ROM | disk | FTP | other *** search
-
- INTRODUCTION
-
- Pipe implements anonymous pipes in AmigaShell, taking advantage of an
- undocumented feature built in it since OS version 2.04.
-
- Anonymous piping, familiar to many from UNIX systems, means directing
- the output of one program to the input of another, without using
- temporary files. Many third part Amiga shells emulate pipes using
- temporary files, but this is slow and can take up a lot of RAM or disk
- space. Pipe uses the PIPE: device to create true pipes between
- programs.
-
- LEGAL
-
- Pipe is Copyright © 1995 by Osma Ahvenlampi, All Rights Reserved.
- Permission granted to distribute free of charge, in unchanged form,
- provided this documentation file is accompanied with the program.
- Permission granted to include on freely distributable software
- libraries such as Fred Fish's software library and the Aminet CD-ROM.
-
- Pipe is provided as is, without any kind of warranty. By using Pipe,
- the user accepts full responsibility for possible damage or data loss
- that might occur, directly or indirectly, from using Pipe.
-
- Pipe is GIFTWARE. If you use Pipe, send me a gift (your own program,
- beer, chocolate, your sister, a new computer, a money donation, etc),
- the address is in the end of this document.
-
- FEATURES
-
- - 100% pure, can be made resident
- - Can be used even with programs that can not use stdin and/or stdout,
- by using the IN: and OUT: pseudo-files.
- - Flushes pipes on error conditions
- - Works 100% with AmigaDOS scripts
- - Will not trash out on invalid command lines such as "Echo | | More |".
-
- INSTALLATION
-
- Pipe needs the PIPE: device mounted. For OS 2.1 and later, this is
- done by moving the PIPE icon from SYS:Storage/DOSDrivers to
- SYS:Devs/DOSDrivers, and rebooting the machine.
-
- Pipe has to be in the Shell search path. A recommended place is C:. If
- you use Pipe a lot, I suggest you make it resident, by adding the
- command "Resident ADD C:Pipe PURE" in S:User-Startup. This will take
- less than 2 kilobytes of memory, and will make use of pipes
- significantly faster.
-
- To make AmigaShell use Pipe, you need to set two shell variables,
- _pchar and _mchar. _pchar is the normal pipe character (usually "|"),
- while _mchar is the "multiple command" character (I recommend "||").
- You can set these permanently by add to S:Shell-Startup the commands
- Set _pchar "|" and Set _mchar "||"
- in S:Shell-Startup (which is executed upon starting a Shell).
-
- If you are not sure how to activate all these without a reboot, I
- suggest you add these commands to the scripts, and reboot you Amiga.
- When you now start a Shell, Pipe is ready to use.
-
- USAGE
-
- In the following examples, I use _pchar "|" and _mchar "||". If you
- set yours to other values, adjust accordingly.
-
- By putting two commands on the same command line, separated from each
- other with the | character, the output of the first command is
- directed to the input of the second command. For example:
-
- List LIBS: | More
-
- will output the LIBS: directory listing through the More pager.
-
- If a command insists on having a filename argument, and will not be
- satisfied with using the standard input or output, you can use the IN
- and OUT: pseudo-files as filenames. Pipe will replace them
- accordingly. For example:
-
- List LIBS: LFORMAT="Version %s%s" | Execute IN:
-
- will show the version information of all the libraries.
-
- You can also concatenate the output of two programs together by using
- the "multiple command" separator. For example:
-
- List SYS: || Type Pipe.doc
-
- will output first the SYS: directory listing, then this Pipe doc file.
- You can also direct these to another pipe:
-
- List SYS: || Type Pipe.doc | More
-
- For those of you who are familiar with the standard UNIX shell syntax,
- the above is similar to
-
- ( ls -l / ; cat Pipe.doc ) | more
-
- used in /bin/sh.
-
- You can combine these in more complex ways:
-
- List LIBS: NOHEAD | Search IN: xpr || Type Pipe.doc | More
-
- will concatenate a listing of all XPR libraries and the Pipe
- documentation, and show them through More.
-
- ( ( ls -l /usr/lib | fgrep -i xpr ) ; cat Pipe.doc ) | more
-
- in /bin/sh syntax.
-
- To get a gziped tar archive expanded in one step, use
-
- gzip -dc foo.tar.gz | tar -xf -
-
- Do not be discouraged by the seemingly complex command lines
- demonstrated above. After some time, you will get used to the syntax,
- and will find Pipe an essential help in Shell work.
-
- BUGS
-
- OUT: will NOT work with a command that is a part of a || structure.
- This is a tradeoff for having || work with a lot of input, and on the
- other hand, not breaking EXECUTE. Programs should not need OUT:
- anyway. Only thing I can think of that needs it is C:Sort, and there
- are significantly better replacements for that.
-
- This is not really a bug in Pipe, but DO NOT use "More IN:" with the
- C= More (version 40.2 atleast). It won't be able to handle that right,
- going into a busy loop.. You can still break it from Xoper etc.
-
- Error situations can act weirdly. Pipe does not attempt to find out
- beforehand whether the commands exist, nor does it try to break
- running commands when an unknown command or other error distrupts the
- pipeline. It will still flush all pipes, but this might mean that the
- first commands in the pipeline might do unnecessary processing with the
- output just flushed away.
-
- Since alias expansion is done after IN:/OUT: replacement, you can't use
- aliases such as "alias psort sort in: out:". Fixing this would require
- a major rewrite, and I can't see it justified by a couple of broken
- programs.
-
- As long as we're talking about aliases, be careful with them. If
- _pchar is set, "alias foo command | another" does NOT make an alias
- "foo" that expands to "command | another". It makes an alias "foo"
- that expands to "command", and pipes the output of the Alias command
- (ie. nothing) to "another". If you want to include pipes in aliases,
- quote the whole alias, as in
- alias foo "command | another"
-
- Please send me bug reports and suggestions on improvement. Don't
- forget the gift, either ;)
-
- HISTORY
-
- Version 1.5 fixes bugs in input/output redirection.
- ilbmtoppm <pic.iff | pnmscale -xysize 320 200 | ppmtogif >pic.gif
- works now.
-
- AUTHOR
-
- Pipe is written by Osma Ahvenlampi. I am a computer engineering
- student at the Helsinki University of Technology. You can reach me by
- email at the address
-
- Osma.Ahvenlampi@hut.fi
-
- or by snailmail (for the time being, anyway) at the address
-
- Osma Ahvenlampi
- Rekipellontie 2 F 55
- 00940 Helsinki
- Finland
-
-